home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d27 / eset21.arc / ESET.SAM < prev    next >
Text File  |  1990-10-10  |  2KB  |  73 lines

  1. These samples are more or less in order of increaing difficulty to
  2. understand. They show some of the capabilities of ESET.
  3.  
  4. ** Test if a directory is in the path and if not add it as the 2nd one
  5.      Eset /U Path*=/c:\turboc;/c:\turboc;/ /N Path*=/;/;c:\turboc;/
  6.  
  7. ** Accept a single key response without ENTER, default to Y on enter only
  8.      Eset Z=Y /UEav Z "Yes, No Maybe, Forgetit >" YyNnMmFf 1
  9.  
  10. ** Check to see if var contains a : then change all to a /
  11.      Eset Z*=.:./. /B Z@=.:./.
  12.  
  13. ** Split date into 3 parts M D and Y
  14.      Eset M=$D D=$S4,2,%%M Y=$S7,4,%%M M=$S1,2,%%M
  15.  
  16. ** if Z is undefined set it to 'ok'
  17.      Eset Z*=/// /N Z=ok
  18.  
  19. ** Define and use a variable ES with default switches
  20.      to set    Eset Es=/DX
  21.      to use    Eset %%Es ........
  22.  
  23. ** Allow user to change variable
  24.      ECHO %XX%
  25.      Eset Xx* "enter /old/new/"
  26.   or
  27.      Eset /D Xx+= /D Xx* " enter /old/new/"
  28.  
  29. ** Allow user to edit variable
  30.      Eset /E Xx "?" 20
  31.  
  32. ** If item does not contain a slash have user correct
  33.      :Rentr
  34.      Eset xx*=,/,/, /eun xx "Must contain a / > " 15
  35.      IF NOT ERRORLEVEL 3 GOTO Rentr
  36.  
  37. ** If user answers Y ask for a name
  38.      Eset /UEa Z=y Z another? 1   Z*=/y/y/  /Bea   Z name?
  39.  
  40. ** Ask for a variable name and then edit it
  41.      Eset /dx zz "? " /e %%zz "?" 127 zz=
  42.  
  43. ** get list from user and bracket with spaces or , depending on what
  44. **      the user used
  45.     Eset /UT Z "? " Z*=/,/,/ /B
  46.     IF (%Z%)==() GOTO Cont
  47.     IF NOT ERRORLEVEL 3 Eset "Z^=," "Z+=," /C
  48.     IF ERRORLEVEL 3 Eset "Z^= " "Z+= " /C
  49.  
  50. ** get user input, if timeout set time limit for all other queries
  51.     Eset Zl= /UEavL5 Z ? Nn 1
  52.     IF (%$e%)==(512) Eset Zl=l5
  53. **    use limit
  54.     Eset Z= /UEav%Zl% Z ? QqYyNnRrPpMm 1
  55.  
  56. ** Extract first item from a list:      [List=xxx yyy zzz]
  57.      eset X=x "X*= x %List% " /T List-=%%X
  58. **  or    [List=xxx,yyy,zzz,]
  59.      Eset X=x "X*=,x,%List%," List-=%%X%%,
  60.  
  61. ** set n1-n4 with s1-s4 which donot exist in n1-n4 or m1-m4
  62. Eset Z=%N1%%N2%%N3%%N4%%M1%%M2%%M3%%M4% Zc=1
  63. FOR %%Z IN (%N1% %N2% %N3% %N4%) DO Eset Zc=$+1
  64. FOR %%Z IN (%S1% %S2% %S3% %S4%) DO Eset Z*=/%%Z/%%Z/ /N Z+=%%Z N%Zc%=%%Z Zc=$+1
  65.  
  66. ** same using loop
  67. Eset Z=%x1%%x2%%x3%%x4%%M1%%M2%%M3%%M4% Zc=1 Zp=0
  68. FOR %%Y IN (%x1% %x2% %x3% %x4%) DO Eset Zc=$+1
  69. :Loop
  70. Eset Zp=$+1 Z*=/%%Zp%%/%%Zp%%/ /N Z+=%%Zp x%Zc%=%%Zp Zc=$+1
  71. IF NOT (%Zp%)==(%Sx%) GOTO Loop
  72.  
  73.